package study.dubbo.springcloud.consumer.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import study.dubbo.api.service.TimeoutService;
import study.dubbo.springcloud.consumer.support.result.Result;
import study.dubbo.springcloud.consumer.support.result.Results;

@Slf4j
@RestController
public class TimeoutController {

    @DubboReference
    private TimeoutService timeoutService;

    @RequestMapping("/timeout")
    public Result timeout(@RequestParam long timeout) {
        timeoutService.timeout(timeout);
        return Results.ok();
    }
}
